package com.tskj.mh.studyroom.service;

import com.alibaba.fastjson.JSONObject;
import com.tskj.mh.studyroom.dao.StudentDAO;
import com.tskj.mh.studyroom.dao.redis.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentService {

    @Autowired
    private StudentDAO studentDAO;

    @Autowired
    private RedisUtil redisUtil;

    public JSONObject getStudentInfo(String adUserName) {
        return studentDAO.getStudentInfo(adUserName);
    }

    public String getAdUserName(String token) {
        Object value = redisUtil.get(token);
        if (value != null) {
            return value.toString();
        }
        return "";
    }
}
